package com.work.utils;

import com.alibaba.druid.pool.DruidDataSourceFactory;

import javax.sql.DataSource;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

public class DruidMangerTest {

    private static DataSource dataSource;

    static {
        Properties pro = new Properties();
        try {
            pro.load(new FileInputStream("C:\\Users\\星星在唱歌\\Desktop\\学习\\LIU\\U2-day02\\src\\com\\work\\druid.properties"));
            dataSource = DruidDataSourceFactory.createDataSource(pro);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static DataSource getDateSource(){
        return dataSource;
    }

    public static void main(String[] args) {
        DataSource dateSource = DruidMangerTest.getDateSource();
        System.out.println(dateSource);
    }
}
